﻿using Love;

public class Program : Scene
{
    private Image _grass;
    private Image _dirt;
    private int _blockWidth;
    private int _blockHeight;
    private int _blockDepth;
    private int _gridSize;
    private int _gridX;
    private int _gridY;
    private int[,] _grid;
    public override void Load()
    {
        _grass = Graphics.NewImage("grass.png");
        _dirt = Graphics.NewImage("dirt.png");
        _blockWidth = _grass.GetWidth();
        _blockHeight = _grass.GetHeight();
        _blockDepth = _blockHeight / 2;

        _gridSize = 20;
        _grid = new int[_gridSize, _gridSize];
        for (int i = 0; i < _gridSize; i++)
        {
            for (int j = 0; j < _gridSize; j++)
            {
                _grid[i, j] = 1;
            }
        }

        _grid[2, 4] = 2;
        _grid[6, 5] = 2;
    }

    public override void Draw()
    {
        for (int x = 0; x < _gridSize; x++)
        {
            for (int y = 0; y < _gridSize; y++)
            {
                if (_grid[x, y] == 1)
                {
                    Graphics.Draw(_grass,
                        _gridX + (y - x) * (_blockWidth / 2),
                        _gridY + (x + y) * (_blockDepth / 2) - (_blockDepth * _gridSize / 2) - _blockDepth);
                }
                //else if (_grid[x, y] == 2)
                //{
                //    Graphics.Draw(_dirt,
                //     _gridX + (y - x) * (_blockWidth / 2),
                //     _gridY + (x + y) * (_blockDepth / 2) - (_blockDepth * _gridSize / 2));
                //}
            }
        }
    }

    static void Main(string[] args)
    {
        Boot.Run(new Program());
    }
}